<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7 charset=utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>用户中心 - 个人资料</title>
<link href="<%=basePath%>/mallstyle/css/global.css" rel="stylesheet"
	type="text/css" />
<link href="<%=basePath%>/mallstyle/css/user.css" rel="stylesheet"
	type="text/css" />
<link href="<%=basePath%>/mallstyle/css/footer.css" rel="stylesheet"
	type="text/css" />
<link type="text/css" href="<%=basePath%>/mallstyle/css/qq.css"
	rel="stylesheet" />
<script type="text/javascript" src="index.php?act=jslang"></script>
<script type="text/javascript"
	src="<%=basePath%>/mallstyle/js/jquery.js" charset="utf-8"></script>
<script type="text/javascript"
	src="<%=basePath%>/mallstyle/js/common.js" charset="utf-8"></script>
<script type="text/javascript"
	src="<%=basePath%>/mallstyle/js/member.js" charset="utf-8"></script>
<script type="text/javascript" src="<%=basePath%>/mallstyle/js/qq.js"
	charset="utf-8"></script>
<!--[if lte IE 6]>
<script type="text/javascript" language="Javascript" src="http://www.999000.cn/themes/mall/default/styles/default/<%=basePath%>/mallstyle/js/hoverForIE6.js"></script>
<![endif]-->
<script type="text/javascript">
			$(function() {
				$('#left h1 span,h2.title a.fold').click(function() {
					if($(this).hasClass('span_close')) {
						$(this).removeClass('span_close');
						$(this).addClass('span_open');
						this.title = 'open';
						closeSubmenu($(this).parent());
					} else {
						$(this).removeClass('span_open');
						$(this).addClass('span_close');
						this.title = 'close';
						openSubmenu($(this).parent());
					}
				});

				var span = $("#child_nav");
				span.hover(function() {
					$("#float_layer:not(:animated)").show();
				}, function() {
					$("#float_layer").hide();
				});

				// tyioocom
				$('.tsearch-tabs li').click(function() {
					$(this).parent().find('li').each(function() {
						$(this).attr('class', '');
					});
					$(this).attr('class', 'tsearch-tabs-active');
					$('.tsearch-panel input[name="act"]').val($(this).attr('ectype'));
				});
				$('.tsearch-panel #keyword').focus(function() {
					$('.tsearch-panel label').hide();
				}).blur(function() {
					if($(this).val() == '') {
						$('.tsearch-panel label').show();
					}
				});

			});

			function closeSubmenu(h1) {
				h1.next('ul').css('display', 'none');
			}

			function openSubmenu(h1) {
				h1.next('ul').css('display', '');
			}
		</script>
<script charset="utf-8" type="text/javascript"
	src="<%=basePath%>/mallstyle/js/jquery.validate.js"></script>
</head>
<style type="text/css">
#footer_links dl {
	width: 170px !important;
	margin-left: 15px;
	_margin-left: 0px;
}

#footer_links {
	width: 1000px !important;
	_width: 930px !important;
	padding: 20px 0px 15px 0px !important;
}

#footer #footer_links2 {
	width: 1000px !important;
	padding: 20px 0px 15px 0px;
}

#footer #footer_links2 dl {
	width: 95px !important;
}

#footer #footer_links2 dl.last {
	width: 130px !important;
}

.niu-xiaoshou {
	cursor: pointer;
}

.niu-rosy {
	width: 100px;
	height: 35px;
	border-radius: 5px;
	color: #fae7e9;
	border: solid 1px #b73948;
	background: #da5867;
	background: -webkit-gradient(linear, left top, left bottom, from(#f16c7c),
		to(#bf404f));
	background: -moz-linear-gradient(top, #f16c7c, #bf404f);
	filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f16c7c',
		endColorstr='#bf404f');
}

.niu-rosy:hover {
	background: #ba4b58;
	background: -webkit-gradient(linear, left top, left bottom, from(#cf5d6a),
		to(#a53845));
	background: -moz-linear-gradient(top, #cf5d6a, #a53845);
	filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#cf5d6a',
		endColorstr='#a53845');
}

.niu-rosy:active {
	color: #dca4ab;
	background: -webkit-gradient(linear, left top, left bottom, from(#bf404f),
		to(#f16c7c));
	background: -moz-linear-gradient(top, #bf404f, #f16c7c);
	filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#bf404f',
		endColorstr='#f16c7c');
}
</style>

<body>
	<div id="site-nav" class="w-full">
		<div class="shoptop w clearfix">
			<div class="login_info">
				hi, <a href="#"><span>${user.uName }</span></a> <a
					href="<%=path%>/rest/user/logout">退出</a> <a href="#">站内消息</a>
			</div>
			<ul class="quick-menu">
				<li class="home"><a href="../../index.jsp">回到首页</a></li>
				<li class="item">
					<div class="menu mytb">
						<a class="menu-hd" href="#">我是买家<b></b></a>
						<div class="menu-bd">
							<div class="menu-bd-panel">
								<div>
									<p>
										<a href="#">已买到的宝贝</a>
									</p>
									<p>
										<a href="#">我的好友</a>
									</p>
									<p>
										<a href="#">我的咨询</a>
									</p>
								</div>
							</div>
						</div>
					</div>
				</li>
				<li class="service"><a href="#">帮助中心</a></li>
			</ul>
		</div>
		<div id="header">
			<div class="w clearfix"></div>
			<div class="w shopnav"></div>
		</div>
		<style>
.borline td {
	padding: 10px 0px;
}

.ware_list th {
	text-align: left;
}
</style>
		<script type="text/javascript">
			$(function() {
				$('#profile_form').validate({
					errorPlacement: function(error, element) {
						$(element).parent('span').parent('b').after(error);
					},
					rules: {
						portrait: {
							accept: 'gif|jpe?g|png'
						}
					},
					messages: {
						portrait: {
							accept: '支持gif、jpeg、jpg、png格式'
						}
					}
				});
				$('input[ectype="change_avatar"]').change(function() {

					var src = getFullPath($(this)[0]);
					$('img[ectype="avatar"]').attr('src', src);
					$('input[ectype="change_avatar"]').removeAttr('name');
					$(this).attr('name', 'portrait');
				});
			});
		</script>
		<div class="content">
			<div id="left">
				<dl class="menu">
					<dt class="first">
						<b></b><span>我的账户</span>
					</dt>
					<dd>
						<a href="<%=path%>/rest/user/myInfo" class="normal"><span
							class="ico2">个人资料</span></a>
					</dd>
					<dd>
						<a href="<%=path%>/rest/address/getAllAddress" class="active"><span
							class="ico7">我的地址</span></a>
					</dd>
				</dl>
			</div>
			<div id="right">
				<div class="location">
					<a href="../../index.jsp">首页</a> <a href="index.php?app=member">用户中心</a>
					<a href="<%=path%>/rest/address/getAllAddress">我的地址</a> 地址列表
				</div>
				<div class="submenu">
					<ul class="tab">
						<li class="active first">
							<h2>
								<a href="javascript:;" onclick="addresslist()">地址列表</a>
							</h2>
						</li>
						<li class="active first">
							<h2>
								<a href="javascript:;" onclick="addaddress()">新增地址</a>
							</h2>
						</li>
					</ul>
				</div>
				<div class="wrap">
					<div class="public">
						<form method="post" enctype="multipart/form-data"
							id="profile_form">
							<div class="information">
								<div class="info individual">
									<table style="margin-top: 20px;">
										<tr>
											<th>序号</th>
											<td>收件人</td>
											<td>收货地址</td>
											<td>联系方式</td>
											<td>是否默认</td>
											<td>操作</td>
										</tr>
										<c:forEach items="${list }" var="list" varStatus="status">
											<tr>
												<th>${status.index + 1}</th>
												<th>${list.adName }</th>
												<th>${list.adAddress }</th>
												<th>${list.adTell }</th>
												<th><c:if test="${list.adStatus==0 }"> 否</c:if> <c:if
														test="${list.adStatus==1 }"> 是</c:if></th>
												<th><a
													href="<%=path%>/rest/address/deleteAddress?adid=${list.adId}">删除</a></th>
											</tr>
										</c:forEach>
									</table>
								</div>
							</div>
						</form>
						<form method="post" action="<%=path%>/rest/address/addAddress"
							enctype="multipart/form-data" id="profile_form2">
							<div class="information">
								<div class="info individual">
									<table>
										<tr>
											<th class="width4">收件人:</th>
											<td><input type="text" class="text width_normal"
												name="adName" value="" /></td>
										</tr>
										<tr>
											<th>收货地址:</th>
											<td><input type="text" class="text width_normal"
												name="adAddress" value="" /></td>
										</tr>
										<tr>
											<th>联系方式:</th>
											<td><input type="text" class="text width_normal"
												name="adTell" value="" /></td>
										</tr>
										<tr>
											<th>是否默认:</th>
											<td class="label"><label> <input type="radio"
													name="adStatus" value="0" />否
											</label> <label> <input type="radio" name="adStatus"
													value="1" />是
											</label></td>
										</tr>
										<tr>
											<th></th>
											<td><input type="submit" class="button niu-rosy"
												value="保存修改" /></td>
										</tr>
									</table>
								</div>
							</div>
						</form>
					</div>
					<div class="wrap_bottom"></div>
				</div>

				<div class="clear"></div>
				<div class="adorn_right1"></div>
				<div class="adorn_right2"></div>
				<div class="adorn_right3"></div>
				<div class="adorn_right4"></div>
			</div>
			<div class="clear"></div>
		</div>
	</div>
	<%@include file="../../../bottom.jsp"%>
	<script type="text/javascript">
			$('#niu-zhenshiName').attr("disabled","true");
			$("#niu-updataMiMa").click(function(){
				$('#niu-zhenshiName').removeAttr("disabled");
			});
		</script>
	<script type="text/javascript">
			
		    addresslist();
			function addresslist(){
				$("#profile_form").show();
				$("#profile_form2").hide();
			}
			function addaddress(){
				$("#profile_form2").show();
				$("#profile_form").hide();
			}
		</script>
</body>

</html>